﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.ServiceModel;
using CinemaDbLib;
using CinemaProject;

namespace CinemaProject
{
public class UserCtrl : WcfServiceLibrary1.Ctrl.IUserCtrl
{
	private UserDB userDB;

	public UserCtrl()
	{
		userDB = new UserDB();
	}

	public void insertUser(User user)
	{
		userDB.insertUser(user);
	}

	public void removeUser(int id)
	{
		userDB.removeUser(id);
	}

    public void updateUser(User user)
	{
		userDB.updateUser(user);
	}

	public User getUser(int id)
	{
		return userDB.getUserById(id);
	}

	public List<User> getUsers()
	{
		return userDB.getUsers();
	}

    public User getUser(string username)
    {
        return userDB.getUserByUsername(username);
    }

    public List<User> getUsersSearch(string name)
    {
        return userDB.getUsersSearch(name);
    }
}
}